/*
 * @Author: mikey.zhaopeng
 * @Date:   2016-06-25 13:00:58
 * @Last Modified by:   mikey.zhaopeng
 * @Last Modified time: 2016-06-28 16:29:39
 */

'use strict';
define([
    './baseBean',
], function(
    BaseBean
) {
    function me() {
        BaseBean.apply(this, arguments);
        var self = this;
        this.getAdMarketFeed = function(callback, errorCallback) {
            var params = {};
            self.p('/admarket/getAdMarketFeed', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.getAdMarketTargetCountry = function(callback, errorCallback) {
            var params = {};
            self.p('/admarket/getAdMarketTargetCountry', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.createAdMarket = function(params, callback, errorCallback) {
            self.p('/admarket/createAdMarket', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }


        this.getAdMarket = function(params, callback, errorCallback) {
            self.p('/admarket/getAdMarket', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.findAdMarket = function(params, callback, errorCallback) {
            self.p('/admarket/findAdMarket', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }


        this.updateAdMarket = function(params, callback, errorCallback) {
            self.p('/admarket/updateAdMarket', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.optimizeAd = function(params, callback, errorCallback) {
            self.p('/admarket/optimizeAd', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }


        this.pauseAdMarket = function(params, callback, errorCallback) {
            self.p('/admarket/pauseAdMarket', params, function(result) {
                if (callback) {
                    callback(result, params);
                }
            }, errorCallback);
        }

        this.getLog = function(params, callback, errorCallback) {
            self.p('/admarket/getLog', params, function(result) {
                if (callback) {
                    _.each(result,function(d){
                        d.optTime=kit.formatTime(d.optTime);
                    });
                    callback(result, params);
                }
            }, errorCallback);
        }



    };
    return new me();
});
